package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.IDrawBookDetailCommentInputModel;
import com.rjwh.dingdong.client.mvp.model.IMathGameDetailCommentInputModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Kay
 * @ClassName DrawBookDetailCommentInputModel
 * @Description
 * @date 2016-8-17
 * @history 2016-8-17 author: description:
 */
public class MathGameDetailCommentInputModel extends BaseModel implements IMathGameDetailCommentInputModel, HttpWebServiceCallBack {

    public MathGameDetailCommentInputModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    /**
     * 添加游戏评论
     *
     * @param bookid  绘本编码
     * @param content 赏析步骤编码
     */
    @Override
    public void doPostMathBookComment(int bookid, String content) {
        Map<String, String> doPostDrawBookCommentParams = new HashMap<>();
        doPostDrawBookCommentParams.put("bookid", Integer.toString(bookid));
        doPostDrawBookCommentParams.put("content", content);
        HttpWebService.getDataFromServer(NetConstant.POSTMATHBOOKCOMMENT, doPostDrawBookCommentParams, true, this);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if (getBasePresenter() != null) {
            getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
        }
    }

}
